#ifndef DBUSMONITOR_P_H
#define DBUSMONITOR_P_H

#include <dbus/dbus.h>
#include <QObject>
#include <QMap>


class DBusMonitor;
class QSocketNotifier;
class DBusMonitorPrivate : public QObject {
Q_OBJECT
Q_DECLARE_PUBLIC(DBusMonitor)
private:
    DBusMonitorPrivate(DBusMonitor *p);
    bool create_and_init_connection();
public Q_SLOTS:
    void quit();
    void handle_dbus_read(int fd);
    void handle_dbus_write(int fd);
    void handle_dbus_execption(int fd);

private:
    static dbus_bool_t add_watch(DBusWatch *w, void *data);
    static void remove_watch(DBusWatch *w, void *data);
private:
    DBusMonitor *const q_ptr;
    DBusConnection *m_conn;
    QMap<int, QSocketNotifier*> fdqsm; //fd-qs map
    QMap<int, DBusWatch*> fddwm; //fd-dbuswatch map
    DBusBusType m_type;
    QString m_addr;



};





#endif // DBUSMONITOR_P_H
